package com.ghline.caloncabe.model;

import com.ghline.caloncabe.GameView;

import android.graphics.Bitmap;
import android.graphics.Canvas;

public class LevelSelectSprite {

	private int x = 0;
    private int y = 0;
    private GameView gameView;
    private int width;
    private int height;
    private boolean isTouch;
    private boolean isUnlock;
    private int levelNo;
    private BitmapFont levelShow;
    private String levelNoString;
    private Bitmap levelSelectBitmap;
    
	public LevelSelectSprite(GameView gameView, Bitmap bmpLevel, BitmapFont levelShow, int x, int y, boolean isUnlock, int levelNo) {
		
		this.gameView = gameView;        
        this.x = x;
        this.y = y;
        this.setUnlock(isUnlock);
        this.levelNo = levelNo;
        setLevelNoString(String.valueOf(this.levelNo));        
        this.levelSelectBitmap = bmpLevel;        
        this.width = bmpLevel.getWidth();
        this.height = bmpLevel.getHeight();
        this.setLevelShow(levelShow);
	}

	public void draw(Canvas canvas) {
		canvas.drawBitmap(levelSelectBitmap, x, y, null);
	}
	
	public void handleActionTouch(int eventX, int eventY) {
		if (eventX >= this.x && eventX <= this.x + this.width
				&& eventY >= this.y && eventY <= this.y + this.width) {
			setTouch(true);
		}
		else {
			setTouch(false);
		}
	}

	public int getWidth() {
		return width;
	}
	public int getHeight() {
		return height;
	}
	public int getX() {
		return x;
	}
	public int getY() {
		return y;
	}

	public GameView getGameView() {
		return gameView;
	}

	public void setGameView(GameView gameView) {
		this.gameView = gameView;
	}

	public Bitmap getLevelSelcetBitmap() {
		return levelSelectBitmap;
	}

	public void setLevelSelcetBitmap(Bitmap levelLockBitmap) {
		this.levelSelectBitmap = levelLockBitmap;
	}

	public BitmapFont getLevelShow() {
		return levelShow;
	}

	public void setLevelShow(BitmapFont levelShow) {
		this.levelShow = levelShow;
	}

	public String getLevelNoString() {
		return levelNoString;
	}

	public void setLevelNoString(String levelNoString) {
		this.levelNoString = levelNoString;
	}

	public boolean isUnlock() {
		return isUnlock;
	}

	public void setUnlock(boolean isUnlock) {
		this.isUnlock = isUnlock;
	}

	public boolean isTouch() {
		return isTouch;
	}

	public void setTouch(boolean isTouch) {
		this.isTouch = isTouch;
	}
}
